python
with open("50M.dat", "wb") as outfile:
outfile.write(b'\x00' * 50 * 1024 * 1024)
# outfile.write(bytes(50 * 1024 * 1024))
go
package main
python
with open("50M.dat", "wb") as outfile:
outfile.write(b'\x00' * 50 * 1024 * 1024)
# outfile.write(bytes(50 * 1024 * 1024))
go
package main
#!/usr/bin/env lua | |
t = { a = 1, b = 2, h = "hello", x = { m = 1, n = "hello world" }, 3, | |
y = { "y", z = "hello there", aa = { a1 = 1, a2 = 2, x = "xyz" } }, | |
bool = { b1 = true, b2 = false, [true] = true, [false] = false }, | |
[100] = "one hundred", ["hello world"] = 100, f = function() return "Returned from a function" end } | |
function dump(t, indentLevel) | |
local indentLevel = indentLevel or 1 | |
local str = "{\n" |
#!/usr/bin/env python3 | |
from string import ascii_lowercase, ascii_uppercase | |
from random import shuffle | |
from time import sleep | |
for letters in [ascii_lowercase, ascii_uppercase]: | |
l = list(range(26)) | |
shuffle(l) | |
c_list = [" "] * 26 |
#!/usr/bin/env python3 | |
from string import ascii_lowercase, ascii_uppercase | |
from random import shuffle | |
from time import sleep | |
for letters in [ascii_lowercase, ascii_uppercase]: | |
l = list(range(26)) | |
shuffle(l) | |
c_list = [" "] * 26 |
Both ^
and ~
themselves mean the parent.
~
followed by a number works the same as putting the same number of ~
. For example, my_commit~3
is the same as my_commit~~~
which refers to the 3rd parent of my_commit
.
But ^2
only makes sense for a merge commit, i.e., merge_commit^2
means the second parent of the merge_commit
, merge_commit^1
is the same as merge_commit^
or merge_commit~
or merge_commit~1
.
On the other hand, repetitive ^
is the same as repetitive ~
. For example, ~~~
is the same as ^^^
, and the same as ~3
.
Some examples:
NodeJS
// base64 encoding a file
const base64EncodedString = fs.readFileSync(imageFileName).toString('base64');
// saving a base64 encoded image to a file
fs.writeFileSync(imageFileName, Buffer.from(base64EncodedString, 'base64'))
Python
Notes from Practical Git for Everyday Professional Use on egghed.io.
Initialize the current local directoy as a git repository locally.
git init --bare
will make the local directory a bare repository which will act as a remote respository.
Clone a remote repository locally. New directory will be created.
#!/usr/bin/env python3 | |
''' | |
You have notes in 3 denominations: two, five and ten. | |
Write a function `change` which takes in one argument which is the money amount, | |
and return the combination of the 3 notes using minimum number of notes | |
that adds up to the given amount. | |
Return None if it is not able to add up to the amount. | |
Assume you have infinite supply of notes in all 3 denominations. | |
Examples: | |
1: the function should return None |
https://en.wikipedia.org/wiki/ASCII#Printable_characters
Codes 20 to 7E, known as the printable characters, represent letters, digits, punctuation marks, and a few miscellaneous symbols. There are 95 printable characters in total.
Code 20, the "space" character, denotes the space between words, as produced by the space bar of a keyboard. Since the space character is considered an invisible graphic (rather than a control character) it is listed in the table below instead of in the previous section.
Code 7F corresponds to the non-printable "delete" (DEL) control character and is therefore omitted from this chart; it is covered in the previous section's chart. Earlier versions of ASCII used the up arrow instead of the caret (5E) and the left arrow instead of the underscore (5F).
#!/usr/bin/env python3 | |
import os | |
import sys | |
import subprocess | |
import tempfile | |
f = 'mycerts.pem' if len(sys.argv) == 1 else sys.argv[1] | |
if os.path.exists(f) and os.path.isfile(f): |