Skip to content

Instantly share code, notes, and snippets.

View alexklibisz's full-sized avatar
:octocat:

Alex Klibisz alexklibisz

:octocat:
View GitHub Profile
@alexklibisz
alexklibisz / logspeed.sh
Created October 20, 2014 04:16
Unix shell script that logs the results of an Internet speed test (using speedtest-cli)
#!/bin/bash
# Alex Klibisz (10/2014)
# Shell script which will call the python speedtest-cli (https://github.com/sivel/speedtest-cli)
# and write the results to two log files - one with simple results, one with verbose results -
# prepended by the date/time of the speed test.
# This script should be either included in the same directory as the speedtest-cli files or
# the speedest-cli.py should be added to the /usr/bin (can use soft link).
@alexklibisz
alexklibisz / country_cow_abbreviation_dump
Created December 17, 2014 04:46
A SQL dump for Postgresql containing 217 countries, their COW (correlates of war) codes, and abbreviations. The data is taken from: http://www.correlatesofwar.org/datasets.htm - first link "COW Country Codes".
CREATE TABLE IF NOT EXISTS country(
id SERIAL not null,
cow_id integer not null,
name varchar(255) not null,
abbreviation varchar(5) not null,
primary key(id, cow_id)
);
INSERT INTO country(cow_id, name, abbreviation) VALUES
@alexklibisz
alexklibisz / mount-drives.sh
Created December 26, 2014 07:50
Linux shell script that determines whether or not a Linux partition in a Windows/Linux dual-boot is being booted directly or through VirtualBox and mounts the data directories accordingly
#!/bin/bash
DIR="/media/alex/Data"
# init
# delete all of the directories that should be symlinked in the home directory
rm -rf /home/alex/Desktop
rm -rf /home/alex/Documents
rm -rf /home/alex/Pictures
rm -rf /home/alex/Videos
@alexklibisz
alexklibisz / cow_countries.js
Created March 6, 2015 17:30
JS Object with country names as keys and { correlates of war id, name, short name } as values.
{
'United States of America': {
cowId: '2',
name: 'United States of America',
shortName: 'USA'
},
Canada: {
cowId: '20',
name: 'Canada',
shortName: 'CAN'
@alexklibisz
alexklibisz / Ionic-cordova-android-setup
Last active March 28, 2019 08:48
Dev environment setup for Ionic, Cordova, Android Setup
#install nodejs, npm, git
sudo apt-get install nodejs nodejs-legacy npm git -y
#install npm packages
sudo npm install -g cordova
sudo npm install -g ionic
sudo npm install -g ripple-emulator
#download the android sdk (http://developer.android.com/sdk/index.html#Other)
mkdir ~/.software && cd ~/.software
@alexklibisz
alexklibisz / lockwait.c
Last active November 7, 2023 12:15
A simple example for using pthread_cond_wait() and pthread_cond_signal() with mutexes and conditional variables.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
/* compile with gcc -pthread lockwait.c */
pthread_cond_t cv;
pthread_mutex_t lock;
@alexklibisz
alexklibisz / callbackFunction.js
Created April 17, 2015 21:44
Simple Javascript callback function example
//predefined callback
a("Hello world", b);
//custom callback
a("Hello world", function(s) {
console.log(s + ", how are you?");
});
@alexklibisz
alexklibisz / apache-reverse-proxy.conf
Created May 25, 2015 19:20
Apache Port Forward / Reverse Proxy Config
# Running some application on port 8080, want to make it
# available at subdomain.example.com
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName subdomain.example.com
ProxyPreserveHost On
# setup the proxy
<Proxy *>
Order allow,deny
@alexklibisz
alexklibisz / demo.css
Last active August 29, 2015 14:23
Generated by SassMeister.com.
.box, .announcement {
background: gray;
padding: 5px;
margin: 10px;
}
.box__header {
background: orange;
padding: 5px;
margin: 10px;
@alexklibisz
alexklibisz / SassMeister-input-HTML.html
Created June 24, 2015 16:26
Generated by SassMeister.com.
<main class="view">
<header class="view__header">
<div class="header-area--fb">
<div class="header-area--fb__primary">
<h1>Header Area Primary, Probably a Title</h1>
</div>
<div class="header-area--fb__secondary">
<p>Header Area Secondary, Dates, Authors, etc.</p>
</div>
</div>