Skip to content

Instantly share code, notes, and snippets.

View sebweaver's full-sized avatar

Sébastien Tisserant sebweaver

  • Weaverlab
  • Conflans-Sainte-Honorine, France
View GitHub Profile
@dudepare
dudepare / sample_crypto_aes.js
Created August 10, 2016 06:51
This is a sample of AES encryption + decryption using CryptoJS. This is a bit different from the examples out there because this one uses a COMPANY header + payload. There's a little bit more processing going on. I also used a CDN for CryptoJS. I hope someone finds this useful.
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/core-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/sha256.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/enc-base64.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script>
<script>
function toWordArray(str){
return CryptoJS.enc.Utf8.parse(str);
}
function toString(words){
@Dufgui
Dufgui / gist:72debe81068bf3ecd7d8
Last active April 25, 2023 14:34 — forked from eduardocardoso/gist:82a629882ddb02ab3677
Script to delete exited containers and untagged/unused images from docker
#!/bin/bash
set -o errexit
echo "Removing exited docker containers..."
docker ps -a -f status=exited -q | xargs -r docker rm -v
echo "Removing dangling images..."
docker images --no-trunc -q -f dangling=true | xargs -r docker rmi
@janko
janko / 01-safe-download.rb
Last active August 23, 2025 16:12
A safe way in Ruby to download a file to disk using open-uri (with/without comments)
require "open-uri"
require "net/http"
Error = Class.new(StandardError)
DOWNLOAD_ERRORS = [
SocketError,
OpenURI::HTTPError,
RuntimeError,
URI::InvalidURIError,
@webdevilopers
webdevilopers / ElectricalEquipmentAdmin.php
Last active December 17, 2019 08:20
Override CRUDController to add custom form elements to list template for batch action usage in SonataAdminBundle
<?php
namespace Acme\DemoBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
class ElectricalEquipmentAdmin extends Admin
{
public function getTemplate($name)
{
@Konstantinusz
Konstantinusz / 1f.rb
Last active January 19, 2025 23:28
1fichier.com premium download script
#!/usr/bin/ruby
#http://premium-leechers.blogspot.com
require "cgi"
require "clipboard"
if ARGV.size != 3 then
STDERR.puts "premium-leechers.blogspot.com"
STDERR.puts "1fichier premium downloader script."
STDERR.puts "Usage: ruby 1f <email> <password> <txt file with links|1fichier link|'clipboard'>"
exit
@hauleth
hauleth / railsproj.sh
Created April 20, 2014 14:36
Rails project generation script
#!/bin/bash
dir="$1"
shift 1
mkdir "$dir"
cd "$dir"
bundler init
echo "gem 'rails'" >> Gemfile
@sinisterchipmunk
sinisterchipmunk / LICENSE
Last active October 23, 2024 21:10
tar, gzip, and untar files using ruby in memory without tempfiles
Copyright (C) 2011 by Colin MacKenzie IV
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in