Skip to content

Instantly share code, notes, and snippets.

@mineta
mineta / marinamele_sieve_atkin.py
Last active September 9, 2023 12:54
Python code. Sieve of Atkin algorithm to find prime numbers
import math
def atkin(nmax):
"""
Returns a list of prime numbers below the number "nmax"
"""
is_prime = dict([(i, False) for i in range(5, nmax+1)])
for x in range(1, int(math.sqrt(nmax))+1):
for y in range(1, int(math.sqrt(nmax))+1):
n = 4*x**2 + y**2
if (n <= nmax) and ((n % 12 == 1) or (n % 12 == 5)):
@badsyntax
badsyntax / nodejs.pp
Created December 19, 2013 15:28
Puppet: Installing node.js via nvm
class nodejs {
exec { 'nvm-install':
command => '/usr/bin/curl https://raw.github.com/creationix/nvm/master/install.sh | /bin/sh',
creates => '/home/vagrant/.nvm',
user => 'vagrant',
environment => 'HOME=/home/vagrant',
require => Package['curl']
}
@msoap
msoap / Go vs Perl memory usage.md
Last active April 11, 2018 07:13
Go vs Perl memory usage

Go vs Perl memory usage

{int}->{int} = int:
  lang (keys² q-ty): MB of memory
  Go   (1500²):   66.38 ■■■■■■■■■■■■■■■■■■■■■■■■■■
  Perl (1500²):  131.46 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■

  Go   (1000²):    40.8 ■■■■■■■■■■■■■■■■

Perl (1000²): 57.65 ■■■■■■■■■■■■■■■■■■■■■■■

@denji
denji / http-benchmark.md
Last active May 22, 2024 16:24
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@evanscottgray
evanscottgray / docker_kill.sh
Last active November 7, 2023 03:40
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt
@homam
homam / AWS_S3_File_Upload.js
Created January 27, 2014 10:08
How to upload files to AWS S3 with NodeJS SDK
var AWS = require('aws-sdk'),
fs = require('fs');
// For dev purposes only
AWS.config.update({ accessKeyId: '...', secretAccessKey: '...' });
// Read in the file, convert it to base64, store to S3
fs.readFile('del.txt', function (err, data) {
if (err) { throw err; }
@yoitsro
yoitsro / gist:8693021
Last active July 22, 2020 14:52
Node + Restify + Passport + Sessions + WebSockets
var restify = require('restify');
// Authentication
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var sessions = require("client-sessions");
var server = restify.createServer();
server.use(restify.queryParser());
server.use(restify.bodyParser());
@npwalker
npwalker / gist:8741257
Last active January 20, 2023 11:44
How to regenerate a puppet agent certificate
  1. On the master: puppet cert clean <agent_certname>
  2. On the agent: mv /etc/puppetlabs/puppet/ssl/ /etc/puppetlabs/puppet/ssl_bak
  • Never do this if you are trying to regenerate the cert for the agent on the master. Instead you would need to delete specific certs
  1. On the agent: puppet agent -t
  2. On the master: puppet cert sign <agent_certname>
@jd-boyd
jd-boyd / jsonpp.go
Last active November 28, 2021 06:30
A Json pretty printer written in golang.
//Build with: go build ./jsonpp.go
package main
import "encoding/json"
import "fmt"
import "io/ioutil"
import "os"
@DakuTree
DakuTree / decryptchromecookies.pl
Last active May 24, 2023 04:47
Decrypt Chrome Cookies File (Perl) - Windows
#!/usr/bin/perl -w
use File::Copy qw(copy);
use DBI;
use Win32::API;
use strict;
use warnings;
print ("Decrypting cookies...\n") && &fix_cookies && print ("Cookies decrypted!\n");