code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231
values | license stringclasses 13
values | size int64 1 2.01M |
|---|---|---|---|---|---|
package org.jf.smali;
import java.io.*;
import org.antlr.runtime.*;
import org.jf.util.*;
import static org.jf.smali.smaliParser.*;
%%
%public
%class smaliFlexLexer
%implements TokenSource
%implements LexerErrorInterface
%type Token
%unicode
%line
%column
%char
%{
private StringBuffer sb = new StringBuffer();
... | zztobat-apktool | brut.apktool.smali/smali/src/main/jflex/smaliLexer.flex | JFlex | asf20 | 22,164 |
/*
* Game
*
* Version 1.0.0
*
* 5/18/13
*
* Author: Rafael Materla
*/
package rafael.materla.gui;
/*
* The Game class creates the game window and HAS-A reference to everything.
* The main method is also found in this class.
*/
import java.awt.Point;
import java.awt.Toolkit;
import ja... | zzzznake | Zzzzznake/src/rafael/materla/gui/Game.java | Java | asf20 | 1,882 |
/*
* Painter
*
* Version 1.0.0
*
* 5/18/13
*
* Author: Rafael Materla
*/
package rafael.materla.gui;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import javax.swing.JPanel;
import rafael.materla.logic.Board;
import rafael.materla.logic.Figure;
import rafael.m... | zzzznake | Zzzzznake/src/rafael/materla/gui/Painter.java | Java | asf20 | 1,967 |
/*
* Timer
*
* Version 1.0.0
*
* 5/18/13
*
* Author: Rafael Materla
*/
package rafael.materla.logic;
import rafael.materla.gui.Painter;
/*
* The Timer class times the events that have to happen to make the game run
* (update board, paint it to the screen, wait, repeat)
* Mate. Feed. Ki... | zzzznake | Zzzzznake/src/rafael/materla/logic/Timer.java | Java | asf20 | 1,189 |
/*
* Board
*
* Version 1.0.0
*
* 5/18/13
*
* Author: Rafael Materla
*/
package rafael.materla.logic;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
/*
* The Board class is the logical part of the game itself. It contains
* informations about the position... | zzzznake | Zzzzznake/src/rafael/materla/logic/Board.java | Java | asf20 | 2,906 |
/*
* Figure
*
* Version 1.0.0
*
* 5/18/13
*
* Author: Rafael Materla
*/
package rafael.materla.logic;
import java.awt.Color;
import java.awt.Point;
public abstract class Figure {
// ---INSTANCE-VARIABLES---------------------------------------------------/
protected Point position;
p... | zzzznake | Zzzzznake/src/rafael/materla/logic/Figure.java | Java | asf20 | 1,300 |
/*
* Head
*
* Version 1.0.0
*
* 5/18/13
*
* Author: Rafael Materla
*/
package rafael.materla.logic;
import java.awt.Color;
final class Head extends SnakePart {
Directions direction;
Directions oldDirection;
// ---CONSTRUCTORS---------------------------------------------------------... | zzzznake | Zzzzznake/src/rafael/materla/logic/Head.java | Java | asf20 | 1,311 |
/*
* Apple
*
* Version 1.0.0
*
* 5/18/13
*
* Author: Rafael Materla
*/
package rafael.materla.logic;
import java.awt.Color;
public final class Apple extends Figure {
Apple(int x, int y) {
super(x, y, Color.RED);
}
Apple() {
super((int) (Math.random() * Board.HORIZONTAL_CELLS)... | zzzznake | Zzzzznake/src/rafael/materla/logic/Apple.java | Java | asf20 | 392 |
/*
* Body
*
* Version 1.0.0
*
* 5/18/13
*
* Author: Rafael Materla
*/
package rafael.materla.logic;
import java.awt.Color;
import java.awt.Point;
final class Body extends SnakePart {
// ---CONSTRUCTORS---------------------------------------------------------/
Body(int x, int y) {
s... | zzzznake | Zzzzznake/src/rafael/materla/logic/Body.java | Java | asf20 | 658 |
/*
* Directions
*
* Version 1.0.0
*
* 5/18/13
*
* Author: Rafael Materla
*/
package rafael.materla.logic;
/*
* Enum class containing the four constant directions the snake head is facing
* NORTH = snake moves up
* EAST = snake moves to the right
* SOUTH = snake moves down
* WEST = sna... | zzzznake | Zzzzznake/src/rafael/materla/logic/Directions.java | Java | asf20 | 462 |
/*
* Snake
*
* Version 1.0.0
*
* 5/18/13
*
* Author: Rafael Materla
*/
package rafael.materla.logic;
import java.awt.Point;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.LinkedList;
public final class Snake implements KeyListener {
// ---INSTANCE-... | zzzznake | Zzzzznake/src/rafael/materla/logic/Snake.java | Java | asf20 | 2,360 |
%blur image and then subsample
function [output] = blurSubsample(input)
%simple average filter (low pass filter)
filterSize = 3;
blurFilter = ones(filterSize,filterSize) * 1/(filterSize*filterSize);
blurredImage = im2double(imfilter(input, blurFilter));
%scale output in half by sampling every other value
output = blur... | zzj928-example-based-super-resolution | blurSubsample.m | MATLAB | asf20 | 354 |
%returns intermediate steps
function [subsampled interpolatedBicubic lowResImage] = prepareLowRes(input)
%simple lowpass/blur filter, all 1s/(size*size), keep size at 3
filterSize = 3;
blurFilter = ones(filterSize,filterSize) * 1/(filterSize*filterSize);
blurredImage = im2double(imfilter(input, blurFilter));
%subsamp... | zzj928-example-based-super-resolution | prepareLowRes.m | MATLAB | asf20 | 641 |
function buildTrainingSet(inputImageFileNames, saveFileName, alpha)
%c contains number of input files
[r c] = size(inputImageFileNames);
%training set is a huge set of key-value pairs
keys = [];
values = [];
%tic and toc are for time profiling in matlab
overallTicId = tic;
for i = 1:c
display(['Generating tr... | zzj928-example-based-super-resolution | buildTrainingSet.m | MATLAB | asf20 | 661 |
function [keys values] = train(inputImage, alpha)
%read in input image
inputImage = im2double(imread(inputImage));
%perform preprocessing steps, blur/downsample/interpolate/highpass
[subsampled interpolatedSubsampled lowResImage] = prepareLowRes(inputImage);
highResImage = im2double(inputImage) - im2double(interpolat... | zzj928-example-based-super-resolution | train.m | MATLAB | asf20 | 676 |
%creates the actual key and values from the patch information
function [key values] = createVectors(alpha, lowResPatches, highResPatches, numRows, numCols)
%key is a 58 pixel vector (for each color channel). 58 pixels includes all
%49 (7x7) pixels from low res patch, and the 9 pixels from first row and
%column of high... | zzj928-example-based-super-resolution | createVectors.m | MATLAB | asf20 | 1,164 |
%performs concatenation of 49 low res pixels to 9 high res pixels
%for more info, see top comments in createVectors.m
function output = vectorize(alpha, lowResPatches, highResPatches, i, j);
lowResPatch = accessPatch(lowResPatches, i,j); %7x7x3
highResPatch = accessPatch(highResPatches, i+1,j+1);
output = zeros(1,58... | zzj928-example-based-super-resolution | vectorize.m | MATLAB | asf20 | 590 |
function scale = getContrastNormalizeScale(input)
meanAbs = abs(mean(input(:)));
epsilon = 0.0001;
scale = meanAbs+epsilon;
end | zzj928-example-based-super-resolution | getContrastNormalizeScale.m | MATLAB | asf20 | 142 |
%function output = rebuildImage(kdTree, key2d, subSampledInput, lowResImage, highResImage, keys, values, lowResPatches, highResPatches, originalInput)
function [subsampled interpolated superResImage differenceInterpolated differenceSuperres originalHiRes] = rebuildImage(kdTree, subSampledInput, values, originalInput, a... | zzj928-example-based-super-resolution | rebuildImage.m | MATLAB | asf20 | 2,930 |
%create an indexed array of patches based on input image
function [patches numRows numCols] = make2dPatchMap(input, patchSize)
[r c d] = size(input);
clippedRows = r-patchSize+1;
clippedCols = c-patchSize+1;
patches = (zeros(clippedRows, clippedCols, patchSize, patchSize, 3));
parfor i = 1:clippedRows
for j = 1... | zzj928-example-based-super-resolution | make2dPatchMap.m | MATLAB | asf20 | 675 |
%obtains the difference between two images, and scales
%it into a 0 to 255 gray level image
function difference = obtainDifference(input1, input2)
[r c d] = size(input1);
difference = zeros(r,c);
for i = 1:r
for j = 1:c
rDiff = input1(i,j,1) - input2(i,j,1);
gDiff = input1(i,j,2) - input2(i,j,2);
... | zzj928-example-based-super-resolution | obtainDifference.m | MATLAB | asf20 | 644 |
function [subsampled interpolated superResImage differenceInterp differenceSuperRes originaHiRes] = superResify(fileName, trueHighResImageName, alpha, bucketSize)
display('Loading training data');
tic;
load(fileName, 'keys', 'values');
toc;
display('Done loading training data');
display('Building kd tree ');
tic;
kdT... | zzj928-example-based-super-resolution | superRes.m | MATLAB | asf20 | 936 |
%This file is the entry function for the GUI represented in the .fig file
function varargout = superResolutionGUI(varargin)
% SUPERRESOLUTION MATLAB code for superResolution.fig
% SUPERRESOLUTION, by itself, creates a new SUPERRESOLUTION or raises the existing
% singleton*.
%
% H = SUPERRESOLUTION retu... | zzj928-example-based-super-resolution | superResolution.m | MATLAB | asf20 | 7,367 |
%simple array indexing for more readable code
function patch = accessPatch(patches, i, j)
patch(:,:,:) = patches(i,j,:,:,:);
end | zzj928-example-based-super-resolution | accessPatch.m | MATLAB | asf20 | 131 |
cmake_minimum_required(VERSION 2.4)
project(fbbs)
set(fbbs_VERSION_MAJOR 0)
set(fbbs_VERSION_MINOR 1)
set(fbbs_VERSION_PATCH 0)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
include_directories(include)
option(ENABLE_SSH "compile ssh module" off)
option(ENABLE_DEBUG "compile de... | zzlydm-fbbs | CMakeLists.txt | CMake | gpl3 | 716 |
/*
* gzip.c - hooks for compression of packets
*
* This file is part of the SSH Library
*
* Copyright (c) 2003 by Aris Adamantiadis
* Copyright (c) 2009 by Andreas Schneider <mail@cynapses.org>
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU... | zzlydm-fbbs | libssh/gzip.c | C | gpl3 | 5,434 |
/*
* init.c - initialization and finalization of the library
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2009 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the ... | zzlydm-fbbs | libssh/init.c | C | gpl3 | 2,023 |
/*
* sftpserver.c - server based function for the sftp protocol
*
* This file is part of the SSH Library
*
* Copyright (c) 2005 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* t... | zzlydm-fbbs | libssh/sftpserver.c | C | gpl3 | 11,574 |
/*
* crypt.c - blowfish-cbc code
*
* This file is part of the SSH Library
*
* Copyright (c) 2003 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either ... | zzlydm-fbbs | libssh/crypt.c | C | gpl3 | 5,931 |
/*
* crc32.c - simple CRC32 code
*
* This file is part of the SSH Library
*
* Copyright (c) 2005 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either ... | zzlydm-fbbs | libssh/crc32.c | C | gpl3 | 4,879 |
/*
* sftp.c - Secure FTP functions
*
* This file is part of the SSH Library
*
* Copyright (c) 2005-2008 by Aris Adamantiadis
* Copyright (c) 2008-2009 by Andreas Schneider <mail@cynapses.org>
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser Gene... | zzlydm-fbbs | libssh/sftp.c | C | gpl3 | 79,809 |
/*
* agent.c - ssh agent functions
*
* This file is part of the SSH Library
*
* Copyright (c) 2008-2009 by Andreas Schneider <mail@cynapses.org>
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free S... | zzlydm-fbbs | libssh/agent.c | C | gpl3 | 11,919 |
/*
* error.c - functions for ssh error handling
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2008 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software... | zzlydm-fbbs | libssh/error.c | C | gpl3 | 3,228 |
/*
* client.c - SSH client functions
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2008 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation... | zzlydm-fbbs | libssh/client.c | C | gpl3 | 17,846 |
/*
* string.c - ssh string functions
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2008 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation... | zzlydm-fbbs | libssh/string.c | C | gpl3 | 4,462 |
/*
* log.c - logging and debugging functions
*
* This file is part of the SSH Library
*
* Copyright (c) 2008 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Fo... | zzlydm-fbbs | libssh/log.c | C | gpl3 | 2,238 |
/*
* session.c - non-networking functions
*
* This file is part of the SSH Library
*
* Copyright (c) 2005-2008 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Found... | zzlydm-fbbs | libssh/session.c | C | gpl3 | 10,459 |
/*
* connect.c - handles connections to ssh servers
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2009 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Soft... | zzlydm-fbbs | libssh/connect.c | C | gpl3 | 12,687 |
/*
* scp - SSH scp wrapper functions
*
* This file is part of the SSH Library
*
* Copyright (c) 2009 by Aris Adamantiadis <aris@0xbadc0de.be>
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Soft... | zzlydm-fbbs | libssh/scp.c | C | gpl3 | 18,582 |
/*
* auth1.c - authentication with SSH protocols
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2008 by Aris Adamantiadis
* Copyright (c) 2008-2009 Andreas Schneider <mail@cynapses.org>
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU ... | zzlydm-fbbs | libssh/auth.c | C | gpl3 | 40,720 |
/*
* dh.c - Diffie-Helman algorithm code against SSH 2
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2008 by Aris Adamantiadis
* Copyright (c) 2009 by Andreas Schneider <mail@cynapses.org>
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of... | zzlydm-fbbs | libssh/dh.c | C | gpl3 | 26,274 |
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
* Simple pattern matching, with '*' and '?' as wildcards.
*
* As far as I am concerned, the code I have written for this software
* can be used freely for any purpose... | zzlydm-fbbs | libssh/match.c | C | gpl3 | 5,655 |
/*
* kex.c - key exchange
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2008 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either ve... | zzlydm-fbbs | libssh/kex.c | C | gpl3 | 21,051 |
/*
* options.c - handle pre-connection options
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2008 by Aris Adamantiadis
* Copyright (c) 2009 by Andreas Schneider <mail@cynapses.org>
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU... | zzlydm-fbbs | libssh/options.c | C | gpl3 | 31,085 |
/*
* socket.c - socket functions for the library
*
* This file is part of the SSH Library
*
* Copyright (c) 2008 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Softwar... | zzlydm-fbbs | libssh/socket.c | C | gpl3 | 15,310 |
AM_CFLAGS = -O2 -pipe -Wall @ENABLE_DEBUG@
AM_CPPFLAGS = -DWITH_SERVER -DWITH_SSH1 -DWITH_SFTP -I../include
lib_LTLIBRARIES = libfbssh.la
libfbssh_la_SOURCES = agent.c auth.c auth1.c base64.c buffer.c callbacks.c \
channels.c channels1.c client.c config.c connect.c \
crc32.c crypt.c dh.c e... | zzlydm-fbbs | libssh/Makefile.am | Makefile | gpl3 | 548 |
/*
* misc.c - useful client functions
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2009 by Aris Adamantiadis
* Copyright (c) 2008-2009 by Andreas Schneider <mail@cynapses.org>
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser G... | zzlydm-fbbs | libssh/misc.c | C | gpl3 | 14,273 |
/*
* keys.c - decoding a public key or signature and verifying them
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2005 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
... | zzlydm-fbbs | libssh/keys.c | C | gpl3 | 36,197 |
/*
* channels1.c - Support for SSH-1 type channels
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2008 by Aris Adamantiadis
* Copyright (c) 2009 by Andreas Schneider <mail@cynapses.org>
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the... | zzlydm-fbbs | libssh/channels1.c | C | gpl3 | 8,740 |
/*
* keyfiles.c - private and public key handling for authentication.
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2009 by Aris Adamantiadis
* Copyright (c) 2009 by Andreas Schneider <mail@cynapses.org>
*
* The SSH Library is free software; you can redistribute it and/or modify
* it und... | zzlydm-fbbs | libssh/keyfiles.c | C | gpl3 | 46,504 |
/*
* gcrypt_missing.c - routines that are in OpenSSL but not in libgcrypt.
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2006 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as publis... | zzlydm-fbbs | libssh/gcrypt_missing.c | C | gpl3 | 2,577 |
/*
* packet.c - packet building functions
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2008 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Found... | zzlydm-fbbs | libssh/packet.c | C | gpl3 | 24,129 |
/*
* poll.c - poll wrapper
*
* This file is part of the SSH Library
*
* Copyright (c) 2009-2010 by Andreas Schneider <mail@cynapses.org>
* Copyright (c) 2003-2009 by Aris Adamantiadis
* Copyright (c) 2009 Aleksandar Kanchev
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under... | zzlydm-fbbs | libssh/poll.c | C | gpl3 | 13,922 |
/*
* callbacks.c - callback functions
*
* This file is part of the SSH Library
*
* Copyright (c) 2009 by Andreas Schneider <mail@cynapses.org>
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Fre... | zzlydm-fbbs | libssh/callbacks.c | C | gpl3 | 1,177 |
/*
* base64.c - support for base64 alphabet system, described in RFC1521
*
* This file is part of the SSH Library
*
* Copyright (c) 2005-2005 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as publishe... | zzlydm-fbbs | libssh/base64.c | C | gpl3 | 7,084 |
/*
* server.c - functions for creating a SSH server
*
* This file is part of the SSH Library
*
* Copyright (c) 2004-2005 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Soft... | zzlydm-fbbs | libssh/server.c | C | gpl3 | 21,927 |
/*
* This file is part of the SSH Library
*
* Copyright (c) 2009 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at... | zzlydm-fbbs | libssh/pcap.c | C | gpl3 | 10,413 |
/*
* channels.c - SSH channel functions
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2008 by Aris Adamantiadis
* Copyright (c) 2009 by Andreas Schneider <mail@cynapses.org>
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser... | zzlydm-fbbs | libssh/channels.c | C | gpl3 | 58,098 |
/*
* messages.c - message parsion for the server
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2009 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Softwar... | zzlydm-fbbs | libssh/messages.c | C | gpl3 | 23,313 |
/*
* buffer.c - buffer functions
*
* This file is part of the SSH Library
*
* Copyright (c) 2003-2009 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; ei... | zzlydm-fbbs | libssh/buffer.c | C | gpl3 | 12,443 |
/*
* config.c - parse the ssh config file
*
* This file is part of the SSH Library
*
* Copyright (c) 2009 by Andreas Schneider <mail@cynapses.org>
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the... | zzlydm-fbbs | libssh/config.c | C | gpl3 | 7,707 |
/*
* wrapper.c - wrapper for crytpo functions
*
* This file is part of the SSH Library
*
* Copyright (c) 2003 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software F... | zzlydm-fbbs | libssh/wrapper.c | C | gpl3 | 28,917 |
/*
* auth1.c - authentication with SSH-1 protocol
*
* This file is part of the SSH Library
*
* Copyright (c) 2005-2008 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Softwa... | zzlydm-fbbs | libssh/auth1.c | C | gpl3 | 7,569 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -pedantic -Werror")
add_definitions(-D_XOPEN_SOURCE=500 -D_BSD_SOURCE)
add_library(fbbspg SHARED pg.c)
target_link_libraries(fbbspg pq)
install(TARGETS fbbspg LIBRARY DESTINATION so)
| zzlydm-fbbs | pg/CMakeLists.txt | CMake | gpl3 | 229 |
#include <endian.h>
#ifndef be64toh
# if __BYTE_ORDER == __LITTLE_ENDIAN
# include <byteswap.h>
# define be64toh(x) bswap_64(x)
# else
# define be64toh(x) (x)
# endif
#endif
#include <arpa/inet.h>
#include <stdint.h>
#include <stdlib.h>
#include "fbbs/dbi.h"
#include "fbbs/util.h"
/** Postgresql epoch (Jan 1, 200... | zzlydm-fbbs | pg/pg.c | C | gpl3 | 3,671 |
BEGIN;
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name TEXT,
passwd TEXT,
nick TEXT,
email TEXT,
flag BIGINT,
perm INTEGER,
logins INTEGER DEFAULT 0,
posts INTEGER DEFAULT 0,
stay INTEGER DEFAULT 0,
medals INTEGER DEFAULT 0,
money INTEGER DEFAULT 0,
birth TIMESTAMPTZ,
gender CHAR,
creation TIMESTAMPTZ,... | zzlydm-fbbs | pg/schema.sql | PLpgSQL | gpl3 | 1,109 |
#!/usr/bin/perl -w
use strict;
use DBI;
use Encode;
use Getopt::Long;
use POSIX;
$| = 1;
my ($host, $port, $db, $user, $dir);
GetOptions(
"h|host=s" => \$host,
"p|port:s" => \$port,
"d|database=s" => \$db,
"u|user=s" => \$user,
"b|basedir:s" => \$dir,
);
$port = 5432 if (not $port);
$dir = '/home/bbs' if (not $... | zzlydm-fbbs | pg/convert.pl | Perl | gpl3 | 6,982 |
#! /bin/sh
echo "========================="
echo "clear web process ..."
echo "========================="
for pid in `ps -A | grep apache2 | awk '{ print $1 }'`
do
kill -9 $pid
echo "kill apache2 (pid:$pid)"
done
for pid in `ps -A | grep bbslogin | awk '{ print $1 }'`
do
kill -9 $pid
echo "kill bbslogin (pi... | zzlydm-fbbs | restart.sh | Shell | gpl3 | 1,544 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -pedantic -Werror")
add_definitions(-D_XOPEN_SOURCE=500)
link_directories(../lib)
add_executable(bbsd bbsd.c sysconf.c termio.c screen.c main.c stuff.c more.c)
target_link_libraries(bbsd crypt dl fbbs)
install(TARGETS bbsd RUNTIME DESTINATION bin)
| zzlydm-fbbs | src/CMakeLists.txt | CMake | gpl3 | 297 |
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "fbbs/sysconf.h"
#include "fbbs/string.h"
#include "fbbs/file.h"
enum {
SC_BUFSIZE = 20480,
SC_KEYSIZE = 256,
SC_CMDSIZE = 256,
LINE_BUFSIZE = 256,
};
struct sys... | zzlydm-fbbs | src/sysconf.c | C | gpl3 | 9,344 |
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <netdb.h>
#include <errno.h>
#include <poll.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "fbbs/bbs.h"
#include "fbbs/util.h"
#include "fbbs/site.h"
extern void start_client(voi... | zzlydm-fbbs | src/bbsd.c | C | gpl3 | 2,765 |
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <wchar.h>
#include <stdarg.h>
#include "fbbs/string.h"
#include "fbbs/screen.h"
/**
* String of commands to clear the entire screen and position the cursor at the
* upper left corner.
*/
#define TERM_CMD_CL "\033[H\033[J"
/**
* String of command... | zzlydm-fbbs | src/screen.c | C | gpl3 | 12,208 |
#ifndef FB_MORE_H
#define FB_MORE_H
#include <stdbool.h>
extern int ansimore(const char *file, bool presskey, int line, int lines, bool expand);
extern void show_help(const char *file);
#endif // FB_MORE_H
| zzlydm-fbbs | include/fbbs/more.h | C | gpl3 | 209 |
#ifndef FB_BBS_H
#define FB_BBS_H
#include "fbbs/site.h"
#define USER_FILE BBSHOME"/db/users"
#define BOARD_FILE BBSHOME"/db/boards"
enum {
IP_LEN = 40,
PATHLEN = 128,
};
#endif // FB_BBS_H
| zzlydm-fbbs | include/fbbs/bbs.h | C | gpl3 | 197 |
#ifndef FB_POST_H
#define FB_POST_H
#include "fbbs/util.h"
enum {
FILE_MARKED = 0x8,
FILE_DIGEST = 0x10,
FILE_NOREPLY = 0x40,
FILE_WATER = 0x80,
};
typedef struct post_t {
seq_t id;
seq_t reid;
seq_t gid;
seq_t owner;
seq_t eraser;
uint_t prop;
uint_t size;
varchar_t title;
fb_time_t date;
fb_time_t de... | zzlydm-fbbs | include/fbbs/post.h | C | gpl3 | 358 |
#ifndef FB_SOCKET_H
#define FB_SOCKET_H
#define BBSD_SOCKET_BASE BBSHOME"/tmp/bbsd-socket"
extern int unix_dgram_connect(const char *basename, const char *server);
extern int unix_dgram_bind(const char *name, int qlen);
#endif // FB_SOCKET_H
| zzlydm-fbbs | include/fbbs/socket.h | C | gpl3 | 245 |
#ifndef FB_WEB_H
#define FB_WEB_H
#include "fbbs/cfg.h"
#include "fbbs/dbi.h"
#include "fbbs/pool.h"
#include <fcgi_stdio.h>
#define CHARSET "utf-8"
enum {
MAX_PARAMETERS = 32,
MAX_CONTENT_LENGTH = 1 * 1024 * 1024,
};
enum {
PARSE_NOSIG = 0x1,
PARSE_NOQUOTEIMG = 0x2,
};
typedef struct pair_t {
char *key;
cha... | zzlydm-fbbs | include/fbbs/web.h | C | gpl3 | 925 |
#ifndef FB_STRING_H
#define FB_STRING_H
#include <stdlib.h>
#define streq(a, b) (!strcmp(a, b))
extern char *trim(char *str);
extern size_t strlcpy(char *dst, const char *src, size_t siz);
extern size_t mbwidth(const char *s);
#endif // FB_STRING_H
| zzlydm-fbbs | include/fbbs/string.h | C | gpl3 | 257 |
#ifndef FB_USER_H
#define FB_USER_H
#include "fbbs/util.h"
enum {
EXT_ID_LEN = 16,
NICK_LEN = 40,
NAME_LEN = 32,
EMAIL_LEN = 40,
PASS_LEN = 14,
};
typedef struct user_t {
seq_t uid;
seq_t eid;
uint_t perm;
uint_t logins;
uint_t posts;
uint_t stay;
uint_t medals;
int money;
char gender;
uchar_t birthy... | zzlydm-fbbs | include/fbbs/user.h | C | gpl3 | 571 |
#ifndef FB_MMAP_H
#define FB_MMAP_H
#include <stddef.h>
/** Memory mapped file information. */
typedef struct {
int fd; ///< file descriptor.
int oflag; ///< open flags.
int lock; ///< lock status.
int prot; ///< memory protection of the mapping.
int mflag; ///< MAP_SHARED or MAP_PRIVATE.
vo... | zzlydm-fbbs | include/fbbs/mmap.h | C | gpl3 | 578 |
#ifndef FB_PASS_H
#define FB_PASS_H
#include <stdbool.h>
enum {
/** Maximum length for a password. (DES: 8 chars, MD5: also 8.) */
MAX_PASSWORD_LENGTH = 24,
};
extern const char *generate_passwd(const char *pw);
extern bool check_passwd(const char *pw_crypted, const char *pw_try);
#endif // FB_PASS_H
| zzlydm-fbbs | include/fbbs/pass.h | C | gpl3 | 308 |
#ifndef FB_TERMIO_H
#define FB_TERMIO_H
#include <stdlib.h>
#include <stdbool.h>
#include "fbbs/util.h"
enum {
IOBUF_SIZE = 4096,
};
enum {
KEY_TAB = 9,
KEY_ESC = 27,
KEY_UP = 0x0101,
KEY_DOWN = 0x0102,
KEY_RIGHT = 0x0103,
KEY_LEFT = 0x0104,
KEY_HOME = 0x0201,
KEY_INS = 0x0202,
KEY_DEL = 0x0203,
KEY_BACK... | zzlydm-fbbs | include/fbbs/termio.h | C | gpl3 | 1,258 |
#ifndef FB_TIME_H
#define FB_TIME_H
#include <time.h>
enum {
DATE_ZH = 0, ///< "2001年02月03日04:05:06 星期六"
DATE_EN = 1, ///< "02/03/01 04:05:06"
DATE_SHORT = 2, ///< "02.03 04:05"
DATE_ENWEEK = 4, ///< "02/03/01 04:05:06 Sat"
DATE_XML = 8, ///< "2001-02-03T04:05:06"
DATE_RSS = 16, ///< "Sat,03... | zzlydm-fbbs | include/fbbs/time.h | C | gpl3 | 435 |
#ifndef FB_ERROR_H
#define FB_ERROR_H
enum {
FB_SUCCESS = 0,
FB_FAILURE = -1,
FB_FATAL = -2,
};
enum {
FB_EINVAL,
};
#endif // FB_ERROR_H
| zzlydm-fbbs | include/fbbs/error.h | C | gpl3 | 145 |
#ifndef FB_HASH_H
#define FB_HASH_H
/**
* @file hash.h
* @brief Hash Tables
*/
enum {
HASH_DEFAULT_MAX = 15, ///< default hash max.
/** indicates a string key when passing as key length. */
HASH_KEY_STRING = -1,
};
/**
* Hash function prototype.
* @param key The key.
* @param klen The length of the key. ::... | zzlydm-fbbs | include/fbbs/hash.h | C | gpl3 | 1,835 |
#ifndef FB_SITE_H
#define FB_SITE_H
#define TESTING
#define DES
#define BBSHOME "/home/bbs"
enum {
BBSUID = 9999,
BBSGID = 9999,
};
#ifdef TESTING
enum {
MAX_USERS = 25000,
USER_HASH_SLOTS = 65535,
MAX_BOARDS = 1000,
MAX_ACTIVE = 1000,
};
#endif
#endif // FB_SITE_H
| zzlydm-fbbs | include/fbbs/site.h | C | gpl3 | 279 |
#ifndef FB_STUFF_H
#define FB_STUFF_H
extern void presskeyfor(const char *msg, int line);
extern void pressanykey(void);
#endif // FB_STUFF_H
| zzlydm-fbbs | include/fbbs/stuff.h | C | gpl3 | 144 |
#ifndef FB_CFG_H
#define FB_CFG_H
#define DEFAULT_CFG_FILE "/etc/fbbs/fbbs.conf"
typedef struct config_t {
int pairs;
int cur;
int *keys;
int *vals;
char *buf;
} config_t;
extern int config_init(config_t *cfg);
extern void config_destroy(config_t *cfg);
extern int config_load(config_t *cfg, const char *file);
e... | zzlydm-fbbs | include/fbbs/cfg.h | C | gpl3 | 408 |
#ifndef FB_BOARD_H
#define FB_BOARD_H
#include "fbbs/util.h"
typedef struct board_t {
seq_t bid;
seq_t parent;
seq_t current;
uint_t flag;
uint_t perm;
char name[18];
char title[62];
} board_t;
typedef struct bm_t {
seq_t bid;
seq_t uid;
fb_time_t date;
} bm_t;
#endif // FB_BOARD_H
| zzlydm-fbbs | include/fbbs/board.h | C | gpl3 | 297 |
#ifndef FB_SCREEN_H
#define FB_SCREEN_H
#include "fbbs/util.h"
#include "fbbs/termio.h"
enum {
SCREENLINE_BUFSIZE = 512,
};
typedef struct screen_line_t {
int oldlen; // Length after last flush.
int len; // Length in the buffer.
bool modified; ... | zzlydm-fbbs | include/fbbs/screen.h | C | gpl3 | 1,717 |
#ifndef FB_UTIL_H
#define FB_UTIL_H
#include <stdint.h>
#include <stddef.h>
#include <inttypes.h>
#define elems(x) (sizeof(x) / sizeof(x[0]))
typedef int64_t fb_time_t;
#define PRIdFBT PRId64
typedef uint64_t ulong_t;
typedef uint32_t uint_t;
typedef uint16_t ushort_t;
typedef uint8_t uchar_t;
typedef uint32_t se... | zzlydm-fbbs | include/fbbs/util.h | C | gpl3 | 547 |
#include <libintl.h>
#define _(str) ((const char *)gettext(str))
| zzlydm-fbbs | include/fbbs/i18n.h | C | gpl3 | 66 |
#ifndef FB_SYSCONF_H
#define FB_SYSCONF_H
#include <stdbool.h>
typedef struct {
int line; ///< Line.
int col; ///< Column.
int level; ///< Level.
const char *name; ///< English name.
const char *desc; ///< Description shown on screen.
const char *arg; ///< Arguments passed to function.
... | zzlydm-fbbs | include/fbbs/sysconf.h | C | gpl3 | 923 |
#ifndef FB_POOL_H
#define FB_POOL_H
#include "fbbs/util.h"
enum {
DEFAULT_POOL_SIZE = 16 * 1024,
};
typedef struct pool_large_t {
void *ptr;
struct pool_large_t *next;
} pool_large_t;
typedef struct pool_block_t {
uchar_t *last;
uchar_t *end;
struct pool_block_t *next;
} pool_block_t;
typedef struct pool_t {... | zzlydm-fbbs | include/fbbs/pool.h | C | gpl3 | 565 |
#ifndef FB_DBI_H
#define FB_DBI_H
#include <stdbool.h>
#include <stdint.h>
#include <libpq-fe.h>
#include "fbbs/util.h"
#define PARAM_TEXT(x) { .value = x, .length = 0, .format = 0 }
#define PARAM_CHAR(x) { .value = &x, .length = 1, .format = 1 }
#define PARAM_SMALLINT(x) { .value = &x, .length = 2, .format ... | zzlydm-fbbs | include/fbbs/dbi.h | C | gpl3 | 2,011 |
#ifndef FB_CACHE_H
#define FB_CACHE_H
#include "fbbs/bbs.h"
#include "fbbs/hash.h"
#include "fbbs/mmap.h"
#include "fbbs/pass.h"
#include "fbbs/user.h"
#define CACHE_SERVER BBSHOME"/tmp/cache-server"
#define CACHE_CLIENT BBSHOME"/tmp/cache-client"
enum {
PASSWORD_QUERY = 0,
};
typedef struct ucache_t {
user_t *be... | zzlydm-fbbs | include/fbbs/cache.h | C | gpl3 | 631 |
#ifndef FB_FILE_H
#define FB_FILE_H
#include <stdbool.h>
extern bool dashf(const char *file);
extern int fb_flock(int fd, int operation);
#endif // FB_FILE_H
| zzlydm-fbbs | include/fbbs/file.h | C | gpl3 | 161 |
/*
* This file is part of the SSH Library
*
* Copyright (c) 2003,2009 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, o... | zzlydm-fbbs | include/libssh/crypto.h | C | gpl3 | 3,307 |
/*
* This file is part of the SSH Library
*
* Copyright (c) 2009 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at... | zzlydm-fbbs | include/libssh/socket.h | C | gpl3 | 2,472 |
/*
* This file is part of the SSH Library
*
* Copyright (c) 2009 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at... | zzlydm-fbbs | include/libssh/string.h | C | gpl3 | 1,249 |