Skip to content

Instantly share code, notes, and snippets.

View larrybolt's full-sized avatar

Larry Boltovskoi larrybolt

  • Orsa
View GitHub Profile
@larrybolt
larrybolt / javascript-map-examples.js
Created February 16, 2018 17:31
javascript map and forEach examples with for and ECMA6
// we have an array, with items
const items = [
'ethan',
'larry',
'katrijn',
'janice'
];
// To go and print all of them
/* Regular, old way of doing it */ console.log("\n\n 1")
# https://stackoverflow.com/questions/2668678/importing-csv-with-line-breaks-in-excel-2007
gawk -v RS='"' 'NR % 2 == 0 { gsub(/\n/, "") } { printf("%s%s", $0, RT) }' input.csv > output.fixed.csv
@larrybolt
larrybolt / a.js
Created March 5, 2017 20:21
NodeJS require singletons
const common = require('./common')
module.exports.add = (e) => common.add(e)
module.exports.get = () => common.get()
@larrybolt
larrybolt / suspend_until
Created March 5, 2016 18:15
Suspend your pc until a certain hour
#!/bin/bash
# Auto suspend and wake-up script
#
# Puts the computer on standby and automatically wakes it up at specified time
#
# Written by Romke van der Meulen <redge.online@gmail.com>
# Minor mods fossfreedom for AskUbuntu
#
# Takes a 24hour time HH:MM as its argument
@larrybolt
larrybolt / blocklist.txt
Created November 6, 2016 14:27
transmission-blocklist-11-2016 source: walshie4/Ultimate-Blocklist
This file has been truncated, but you can view the full file.
# List distributed by iblocklist.com
Malicious:1.192.128.23-1.192.128.23
Malicious:5.12.220.33-5.12.220.33
Malicious:5.101.168.211-5.101.168.211
Malicious:5.178.68.196-5.178.68.196
Malicious:5.189.133.185-5.189.133.185
Malicious:5.189.143.31-5.189.143.31
Malicious:5.189.146.159-5.189.146.159
Malicious:5.196.242.78-5.196.242.78
// Let's say we have an array of candy
var all_candy = [
{
name: 'Mars',
price: 1,
category: 'chocolate'
},
{
name: 'Snickers',
# get cpu temp
/opt/vc/bin/vcgencmd measure_temp
# get lists with most cpu-consuming processes
top -b -n 1 | head -n 12
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -6
@larrybolt
larrybolt / gist:7807603
Created December 5, 2013 15:34
Dizzying but invisible depth
@larrybolt
larrybolt / report_php_test.php
Created October 6, 2013 22:58
Quick test of reportr!
<?php
$url = 'http://www.reportr.io';
$apikey = 'API KEY';
// Create a model, you only need to do this once, check afterwards at:
// http://www.reportr.io/api/API-KEY/models
$data = array(
'namespace' => 'ping',
'event' => 'ping',
'name' => 'Ping',
@larrybolt
larrybolt / Captive Network Assistant
Created August 21, 2013 13:49
Telenet Hotspot/Homespot auto-login Should be placed at: `/System/Library/CoreServices/Captive Network Assistant.app/Contents/MacOS/Captive Network Assistant` overwriting the file
#!/usr/bin/php
<?php
$SSID=trim(`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | awk -F: '/ SSID:/ {print $2}' | sed -e 's/.*SSID: //'`);
if ( $SSID == 'TELENETHOTSPOT' )
{
if (`curl --cookie-jar /tmp/cookiejar \
--data "c=std&lang=nl&checkterms=1&userid=USERNAME&password=PASSWORD&remember=on&terms=on" \
--cookie "TNLANG=nl&TN_HS_COOKIE_DETECT=HELLO" \
--max-time 60 \
--user-agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:20.0) Gecko/20100101 Firefox/20.0" \