Skip to content

Instantly share code, notes, and snippets.

View azakordonets's full-sized avatar

Andrew Zakordonets azakordonets

View GitHub Profile
@rb2k
rb2k / gist:8372402
Last active April 15, 2024 19:30
A jenkins script to clean up workspaces on slaves
// Check if a slave has < 10 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
for (node in Jenkins.instance.nodes) {
@egonSchiele
egonSchiele / generate_valid_isbn.rb
Created August 15, 2013 20:29
Generate a valid ISBN number in ruby
def generate_valid_isbn
prefix = 978.to_s # must be 978 or 979
registration_group_element = rand(10).to_s
registrant_element = (rand(90000) + 10000).to_s
publication_element = (rand(900) + 100).to_s
_isbn = prefix + registration_group_element + registrant_element + publication_element
check_digit = 0
i = 0
_isbn.each_char do |letter|
i+= 1
@willurd
willurd / web-servers.md
Last active May 4, 2024 07:22
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@makotom
makotom / isbn.js
Last active March 10, 2019 14:44
ISBN tools by JS
var ISBN = (function(){
"use strict";
var validateISBN13 = function(isbnChars){
var checksum = 0;
isbnChars.forEach(function(isbnChar, key){
checksum += parseInt(isbnChar, 10) * (key % 2 === 1 ? 3 : 1);
});
@archagon
archagon / playlist-to-podcast.py
Created September 28, 2012 07:03
A script that downloads videos from YouTube playlists, extracts their audio, and only downloads missing files each time it's run. Also generates an iTunes-compliant podcast xml file for private hosting purposes. Requires youtube-dl, ffmpeg, and ffprobe.
# YouTube playlist audio retreiver and iTunes-compliant podcast XML generation tool.
# This script will download each video file from the specified YouTube playlist, losslessly extract
# the audio, delete the video, and ultimately produce an iTunes-compliant podcast XML with the
# appropriate metadata, including chapter markers (if provided in the description). If you run the
# script again, only videos that haven't already been converted will be downloaded, allowing you to
# schedule the script to run as often as needed without stressing your internet connection or
# hard drive space. After generating the files and xml, you can easily host them on a local server
# in order to use them with iTunes or your favorite podcast aggregator -- but that's beyond this
# script's jurisdiction.
@Mononofu
Mononofu / json.scala
Created September 18, 2012 11:34
Beautiful JSON handling in Scala
package EasyJSON
import net.minidev.json.JSONValue
import net.minidev.json.JSONArray
import net.minidev.json.JSONObject
import scala.collection.JavaConversions._
object JSON {
def parseJSON(s: String) = new ScalaJSON(JSONValue.parse(s))
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@tarun3kumar
tarun3kumar / seemailverify.java
Last active July 26, 2020 23:28
Selenium email verification
import javax.mail.Authenticator;
import javax.mail.Flags;
import javax.mail.Folder;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Store;
import javax.mail.internet.InternetAddress;
import javax.mail.search.FromTerm;
@avar
avar / 30-income-calculon.pl
Last active February 12, 2024 18:34
Calculate your income in The Netherlands with and without a 30% ruling.
# To check if this is up-to-date with the tax rates go to
# http://www.expatax.nl/tax-rates-2016.php and see if there's anything
# newer there.
#
# I make no guarantees that any of this is correct. I calculated this
# at the time and have been updating it when new tax rates come along
# because people keep finding this useful.
#
# There's also an interactive JS version of this created by
# @stevermeister at
@dmitriy-kiriyenko
dmitriy-kiriyenko / console
Created May 16, 2011 12:51
Init.d to start/stop xvfb. Put it into /etc/init.d and chmod it to 755
apt-get install xvfb
apt-get install firefox