Skip to content

Instantly share code, notes, and snippets.

@ozars
ozars / pre-commit
Last active April 16, 2024 03:03
go format precommit
#!/bin/bash -xe
for f in `git diff --name-only --cached --diff-filter=AM`; do
if [[ $f == *.go ]]; then
gofmt -w $f
git add $f
fi
done
# vim: set sts=2 ts=2 sw=2 et ft=bash
@ozars
ozars / rmzn
Created April 12, 2021 01:35
ramazan takvimi
#!/bin/bash
# License: Public Domain CC0 https://creativecommons.org/publicdomain/zero/1.0/
schedule=$'1 13, Tue 05:49 AM 01:28 PM 05:06 PM 07:57 PM 09:08 PM
2 14, Wed 05:47 AM 01:28 PM 05:06 PM 07:58 PM 09:09 PM
3 15, Thu 05:46 AM 01:28 PM 05:06 PM 07:58 PM 09:10 PM
4 16, Fri 05:44 AM 01:28 PM 05:06 PM 07:59 PM 09:11 PM
5 17, Sat 05:43 AM 01:27 PM 05:06 PM 08:00 PM 09:12 PM
6 18, Sun 05:42 AM 01:27 PM 05:06 PM 08:01 PM 09:12 PM
@ozars
ozars / spark-internal-doc.diff
Created October 8, 2020 00:17
Building spark scala API docs with internal packages
diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala
index 6328daec02..3cf549eda9 100644
--- a/project/SparkBuild.scala
+++ b/project/SparkBuild.scala
@@ -832,12 +832,12 @@ object Unidoc {
.map(_.filterNot(_.getCanonicalPath.contains("org/apache/spark/util/collection")))
.map(_.filterNot(_.getCanonicalPath.contains("org/apache/spark/util/kvstore")))
.map(_.filterNot(_.getCanonicalPath.contains("org/apache/spark/sql/catalyst")))
- .map(_.filterNot(_.getCanonicalPath.contains("org/apache/spark/sql/execution")))
+ // .map(_.filterNot(_.getCanonicalPath.contains("org/apache/spark/sql/execution")))
@ozars
ozars / README.md
Last active October 24, 2019 20:48
ARROW STATUS
@ozars
ozars / Binary.hpp
Created October 1, 2019 22:08
Binary data wrapper for C++14 (Remove constexprs for C++11)
#include <cstddef>
#include <utility>
#include <iterator>
template<typename T>
struct Binary {
union {
T value;
char bin[sizeof(T)];
};
@ozars
ozars / CUSTOM-CONTAINERS-AS-RANGES.md
Last active May 24, 2023 21:14
Converting user-defined containers to ranges
~/tmp/range$ g++ main.cpp -std=c++17 -Irange-v3/include -o main && ./main
0
1
2
3
4
5
6
7
@ozars
ozars / MEMTRIM.md
Last active October 18, 2018 17:58
A useful trim function in C for non-NULL terminated strings

I was looking for a qucik trim function for non-null terminated strings in C. I came up with below solution which worked for me:

#include <ctype.h>  /* for isspace */
#include <stddef.h> /* for size_t  */

int memtrim(const char *mem, size_t size, const char **begin, const char **end)
{
    const char *temp_begin;
 const char *temp_end;
@ozars
ozars / SSH-AGENT.md
Last active September 23, 2018 20:40
Convenient ssh-agent and forwarding configuration

If you'd like to ensure only one instance of ssh-agent is working in background, add this to your .bashrc (or .zshrc if you are using zsh):

function setup_ssh_agent {
  local SSH_AGENT_DATA
  local SSH_AGENT_RUN_NEW
  local SSH_AGENT_CMD_LINE
  # If there is no active agent
  if [ -z "$SSH_AUTH_SOCK" ]; then
    # See if there is session from previous ssh-agent run
@ozars
ozars / DUMP-TWITTER-FOLLOWERS.md
Last active August 25, 2018 16:02
Simple python script for taking snapshot of Twitter followers

Dump Twitter Followers

I was looking for tracking my unfollowers in Twitter. Yet, online services require bunch of unnecessary permissions, which I don't like to give. So, I wrote this simple script.

This python script dumps number of Twitter followers and ID and screen name of followers at that moment. Useful for simple tracking of unfollowers or new followers. (Dump script output to file now and then, and then inspect diff for unfollowers or new followers)

Usage

  • Install python.
  • Get API keys from Twitter's developer platform if you don't have already. Replace REPLACE_THIS parts in below script with consumer/access token keys/secrets. Update: Applications for new Twitter API keys requires review and approval by Twitter staff now. So, this step may take some time.