This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pool_size: number of threads | |
# jobs: A queue (See: https://rubyapi.org/3.0/o/queue) | |
def thread_pool(pool_size: 4, jobs:, &block) | |
threads = [] | |
results = [] | |
mutex = Mutex.new | |
pool_size.times do | |
threads << Thread.new do | |
while !jobs.empty? do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.9" | |
services: | |
jenkins-docker: | |
image: docker:dind | |
privileged: true | |
volumes: | |
- jenkins-docker-certs:/certs/client | |
- jenkins_home:/var/jenkins_home |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"singleQuote": true, | |
"semi": false, | |
"trailingComma": "none" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Randomize the order of the elements in a given array. | |
* source: https://github.com/pazguille/shuffle-array/blob/master/dist/shuffle-array.js | |
* @param {Array} arr - The given array. | |
* @returns {Array} | |
*/ | |
export function shuffle (arr) { | |
if (!Array.isArray(arr)) { | |
throw new Error('shuffle expect an array as parameter.') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pipe = (...fns) => x => fns.reduce((v, f) => f(v), x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls -a |\ | |
grep -E "^\.(.)+~$" |\ | |
xargs -I {} ls -l {} |\ | |
awk {'print $5'} |\ | |
paste -sd+ |\ | |
bc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
BSIZE=$(du -Ss $PWD | awk '{print $1}') | |
function finish(){ | |
ASIZE=$(du -Ss $PWD | awk '{print $1}') | |
FSIZE=$((BSIZE-ASIZE)) | |
echo $(python -c "print($FSIZE/1000.0)")MB | |
} | |
trap finish EXIT | |
find $PWD -maxdepth 1 -size -1024k -iname "*.jpg" -or -iname "*.png" | xargs -I '{}' sh -c '(echo converting "{}" && cwebp "{}" -mt -q 80 -o "{}".webp 2> /dev/null || true) && rm "{}"' | |
#Remove -maxdepth 1 to make it recursive (NOT RECOMMENDED) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -o vpn.zip -s "https://www.vpnbook.com/free-openvpn-account/VPNBook.com-OpenVPN-US1.zip" && unzip vpn.zip -d ~/vpn_files && echo "vpnbook" > ~/.auth && curl -s "https://www.vpnbook.com/" | grep Password | tr -d '\t\n\r\f' | grep -Eo 'Password: [a-zA-Z0-9]*' | uniq | sed 's/Password: //' >> ~/.auth && sudo openvpn --config ~/vpn_files/vpnbook-us1-tcp443.ovpn --auth-user-pass ~/.auth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Trigger] | |
Type = File | |
Operation = Upgrade | |
Target = * | |
[Action] | |
When = PostTransaction | |
Exec = /etc/pacman.d/hooks/ruby-gems-update.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define MAX 1000001 | |
int main() | |
{ | |
int size,i,x,most=-1,mostn,times[MAX],start[MAX],end[MAX]; |
NewerOlder