This file contains hidden or 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
| ╭─james@darktech ~ | |
| ╰─$ sudo yum install bash -y | |
| Resolving Dependencies | |
| --> Running transaction check | |
| ---> Package bash.x86_64 0:4.2.47-3.fc20 will be updated | |
| ---> Package bash.x86_64 0:4.2.47-4.fc20 will be an update | |
| --> Finished Dependency Resolution | |
| .. | |
| .. | |
| Complete! |
This file contains hidden or 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
| #!/bin/bash | |
| while [ `mysql -e "show slave status" | grep -c "Error_code: 1062"` -ge 1 ]; do | |
| `mysql -e "SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE"` | |
| echo -n "."; sleep 1 | |
| done |
This file contains hidden or 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
| echo "Fixing ownership and permissions..." | |
| chmod -R 755 /System/Library/Extensions/* | |
| chown -R root:wheel /System/Library/Extensions/* | |
| chown root:admin / | |
| echo "Rebuilding kext cache..." | |
| kextcache -system-prelinked-kernel | |
| kextcache -system-caches |
This file contains hidden or 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
| package com.example.helloworld; | |
| public class HelloWorld | |
| { | |
| public void sayHelloFromFile(){ | |
| FileResource resource = new FileResource("hello_unicode.txt"); | |
| for(String line : resource.lines()){ | |
| System.out.println(line); | |
| } |
This file contains hidden or 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
| #!/bin/bash | |
| sum=0 | |
| [ $# -ge 1 -a -f "$1" ] && input="$1" | |
| cat $input | grep -o '[0-9]*' | while IFS= read -r line | |
| do | |
| sum=$((sum + line)) | |
| echo $sum >> /tmp/sum.tmp |
This file contains hidden or 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
| // | |
| // BackgroundTask.h | |
| // tomtrack | |
| // | |
| // Created by Liam Edwards-Playne on 13/02/2016. | |
| // | |
| #import "RCTBridgeModule.h" | |
| @interface BackgroundTask : NSObject <RCTBridgeModule> |
This file contains hidden or 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
| function mutation(arr) { | |
| var checkArr = arr[1].toLowerCase().split(""); | |
| for (var i=0; i<arr[1].length; i++) { | |
| if (arr[0].toLowerCase().indexOf(checkArr[i]) == -1) { | |
| return false; | |
| } | |
| } | |
| return true; | |
| } |
This file contains hidden or 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
| function sumPrimes(num) { | |
| // Sum all the prime numbers up to and including the provided number. | |
| // | |
| // A prime number is defined as a number greater than one and having only | |
| // two divisors, one and itself. For example, 2 is a prime number because | |
| // it's only divisible by one and two. | |
| // | |
| // The provided number may not be a prime. |
This file contains hidden or 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
| # Backup database Globals | |
| su - postgres -c "pg_dumpall -g --file=/tmp/globals.sql;" | |
| # Backup all databases | |
| su - postgres -c 'psql -At -c "SELECT datname FROM pg_database WHERE NOT datistemplate"' | \ | |
| while read f; | |
| do su - postgres -c "pg_dump --format=c --file=/tmp/$f.sqlc $f"; | |
| done; |
This file contains hidden or 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
| # First get ID of running container | |
| $ docker ps | |
| CONTAINER ID ... | |
| 5776d1849024 ... | |
| # Next we take a snapshot of the docker container by first pausing (-p) the container | |
| $ docker commit -p 5776d1849024 mysql | |
| e09f9ac65c8b3... | |
| # The commit arg saves the entire snapshot as a docker image with a name mysql: |