Skip to content

Instantly share code, notes, and snippets.

@codeguru42
codeguru42 / output
Last active February 22, 2018 16:36
F
======================================================================
FAIL: test_foo (__main__.FooTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/l/.IntelliJIdea2017.3/config/scratches/scratch.py", line 11, in test_foo
self.assertEqual(expected, actual)
AssertionError: 'foobar' != <MagicMock name='mock.foo()' id='140619506578448'>
----------------------------------------------------------------------
@codeguru42
codeguru42 / foo.py
Last active February 21, 2018 23:38
def foo(bar):
baz = bar.func()
if baz.name.lower()[-3:] == 'txt':
return baz.boo()
@codeguru42
codeguru42 / arch-linux-install.md
Last active September 30, 2017 17:41 — forked from Archerious/arch-linux-install.md
Minimal instructions for installing arch linux on an UEFI SSD system with full system encryption using dm-crypt and luks
@codeguru42
codeguru42 / arch-linux-install.md
Created September 30, 2017 17:37 — forked from kylemanna/arch-linux-install.md
Minimal instructions for installing arch linux on an UEFI NVMe system with full system encryption using dm-crypt and luks
def main():
with open(sys.argv[1]) as file:
plaintexts = map(lambda line : cryptopals.break_xor(bytes.fromhex(line.strip())), file)
for plain in plaintexts:
print(plain)
best = min(plaintexts, key=cryptopals.distance_from_english)
print(best)
import unittest
class MyTests(unittest.TestCase):
def __init__(self, x, y):
super(MyTests, self).__init__("testMyMethod")
self.x = x
self. y = y
def testMyMethod(self):
self.assertEqual(self.y, my_method(self.x))
@codeguru42
codeguru42 / quantum_run.text
Created December 3, 2016 23:19
Run of Quantum Computer Simulator
myrdraal% python main-file.py
How many qubits would you like to use? (Currently, only supports 1): 2
Would you like your initial qubits to be in the |0> state or |1> state? 0 or 1: 0
['Hadamard', 'X', 'Z', 'Y', 'sqrtX', 'phase shift', 'measurement', 'custom']
['cNOT', 'swap']
['Toffoli']
what gate would you like to use for 1st qubit? Use the list of single qubits at the top, plus control or targettarget
Which gate is this target qubit for? See list of two qubit gates at the top.X
Done with your 1st qubit? y or n
$ git status
On branch ganujan/377/main
Your branch is up-to-date with 'ganujan/377'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: android/build/intermediates/transforms/dex/lite/debug/folders/1000/1f/main/classes.dex
no changes added to commit (use "git add" and/or "git commit -a")
@codeguru42
codeguru42 / CustomAdapter.java
Created February 14, 2016 20:23
ArrayAdapter
public class CustomAdapter extends ArrayAdapter<Pipeline> {
private List<Pipeline> data;
public CustomAdapter(Context context, List<Pipeline> data) {
super(context, -1);
this.data = data;
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent,
Bundle savedInstanceState) {
Log.d(TAG, "onCreateView()");
View fragmentView = inflater.inflate(R.layout.image, parent, false);
ImageView imageView = (ImageView) fragmentView.findViewById(R.id.image);
imageView.setImageResource(imageId);
return fragmentView;