Skip to content

Instantly share code, notes, and snippets.

View johnSerrano's full-sized avatar

John H Serrano johnSerrano

  • google
  • Seattle
View GitHub Profile
@johnSerrano
johnSerrano / drop
Created October 2, 2016 04:49
script to move files into dropbox with size checking
#!/bin/bash
#Script for moving files into Dropbox. Makes sure there's no nasty surprises.
set -euo pipefail
echo "Calculating size..."
du -hcs $*
echo "Drop this much data?"
select yn in "Yes" "No"; do
case $yn in
Yes ) cp $* ~/Dropbox; break;;
No ) exit;;
#include "hashtable.h"
#include <stdio.h>
int print_hashtable(HashTable *ht);
HashTable *ht_create(unsigned int size);
int ht_put(HashTable *hashtable, const char *key, const char *value);
unsigned int hash(const char *key, unsigned int size);
int main(void) {
HashTable *ht = ht_create(5);
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.5/socket.io.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script>
$(document).ready(function() {
var socket = io.connect('http://' + document.domain + ':' + location.port);
socket.on("loaded", function() {
console.log("loaded adsfadsfasdfadf");
@johnSerrano
johnSerrano / index.html
Created June 27, 2016 17:44
test for socket
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.5/socket.io.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script>
$(document).ready(function() {
var socket = io.connect('http://' + document.domain + ':' + location.port);
var hello = {"id": "asDFasDF12", "word_1": "Flask", "word_2": "Sockets", }
socket.emit("hello", hello);
public class Account
{
private double checkingBalance;
private double savingsBalance;
public Account ( Double balance1, Double balance2 )
// constructor
{
checkingBalance = balance1;
savingsBalance = balance2;
public class Temp
{
public static void main(String[] args)
{
int first_argument = Integer.parseInt(args[0]);
int second_argument = Integer.parseInt(args[1]);
System.out.println("first_argument: " + first_argument);
System.out.println("second_argument: " + second_argument);
public class Temp
{
public static void main(String[] args)
{
System.out.println(args[0]);
}
}
public class Temp
{
public static void main(String[] args)
{
for (int i = 0; i < args.length; i++) {
System.out.println(args[i]);
}
}
}
import java.util.Random;
public class Temp{
public static void main(String[] args)
{
Random random = new Random();
//sum of two random integers
int q = random.nextInt(6)+1;
int c1 = random.nextInt(6)+1;
@johnSerrano
johnSerrano / slackpost
Last active September 29, 2015 00:05
slackpost
#!/bin/bash
FLAG_n='BOT'
FLAG_c='#general'
FLAG_m=''
while getopts 'n:c:m:h' flag; do
case "${flag}" in
h) echo
echo 'SLACKPOST'