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/env python3 | |
from enum import Enum | |
from queue import Queue, Empty | |
class Action(Enum): | |
addMessage = 1 | |
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
# CODE MOVED TO: https://github.com/Kwpolska/datecond |
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
N. <raw format="html" xml:space="preserve"><pre class="code bash"><a name="rest_code_d86c70c19454410b923d46ffb81e8c5f-1"></a>sudo vim /etc/lightdm/lightdm-gtk-greeter.conf | |
</pre></raw> | |
N. <raw format="html" xml:space="preserve"><pre class="code ini"><a name="rest_code_485b10953d80423e9d1e89fb6aae9041-1"></a><span class="k">[base]</span> | |
<a name="rest_code_485b10953d80423e9d1e89fb6aae9041-2"></a><span class="na">session</span><span class="o">=</span><span class="s">/usr/bin/startlxde</span> | |
<a name="rest_code_485b10953d80423e9d1e89fb6aae9041-3"></a><span class="err">...</span> | |
<a name="rest_code_485b10953d80423e9d1e89fb6aae9041-4"></a><span class="k">[userlist]</span> | |
<a name="rest_code_485b10953d80423e9d1e89fb6aae9041-5"></a><span class="na">disable</span><span class="o">=</span><span class="s">1</span> | |
</pre></raw> | |
N. <raw format="html" xml:space="preserve"><pre class="code python"><a name="rest_code_3c1e76e33f5947f39f83e81945e24503-1"></a><span class="n">foo</span> | |
<a name="rest_code_3c1e76e33f5947f39f83e81 |
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/env python3 | |
from datetime import * | |
print(datetime.now() + timedelta(100), end=' (local time)\n') |
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
def foobar(number): | |
return "Number is %d" % number | |
class GenericFoo(object): | |
foo = None | |
def do_things(self): | |
print(self.foo(7)) | |
class CustomFoo(GenericFoo): | |
foo = foobar |
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
import random | |
inp = list(range(1, 1001)) | |
needle = random.randrange(1, 1001) | |
p = 0 | |
q = len(inp) | |
pos = (p + q) // 2 | |
while inp[pos] != needle: | |
print(pos) | |
if inp[pos] > needle: |
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
java.lang.NullPointerException | |
at org.eclipse.swt.widgets.TabFolder.gtk_switch_page(TabFolder.java:570) | |
at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2009) | |
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4723) | |
at org.eclipse.swt.internal.gtk.OS._gtk_widget_show(Native Method) | |
at org.eclipse.swt.internal.gtk.OS.gtk_widget_show(OS.java:14774) | |
at org.eclipse.swt.widgets.TabFolder.createItem(TabFolder.java:311) | |
at org.eclipse.swt.widgets.TabItem.createWidget(TabItem.java:123) | |
at org.eclipse.swt.widgets.TabItem.<init>(TabItem.java:75) | |
at org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathsBlock.createControl(BuildPathsBlock.java:228) |
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
class Ship { | |
public String name; | |
public int weight; | |
public Ship(String name_, int weight_) { | |
name = name_; | |
weight = weight_; | |
} | |
public String toString() { |
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
#!/bin/bash | |
# Convert drive to ext4. | |
# License: CC0. | |
if [ "$1" = "" ]; then | |
echo "Which device?" | |
exit | |
fi | |
tune2fs -O extents,uninit_bg,dir_index $1 | |
fsck -f $1 | |
$EDITOR /etc/fstab |
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/env python3 | |
"""Automatically unzip any .zip files in ~/Downloads to the CWD. | |
Copyright © 2016, Chris Warrick. | |
Licensed under the 3-clause BSD license. | |
""" | |
import logging | |
import os | |
import time |